package com.atguigu.gmall.gmallsuger.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface KeywordMapper {
    
    
    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(ct * multiIf(source = 'search', 10, source = 'click', 8, source = 'order', 6, 0)) AS score\n" +
        "FROM keyword_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword\n")
    List<Map<String, Object>> statsKeyword(@Param("date") int date);
}
